public class Exam3_4 {
    public static void main(String args[]) {
            int i;
            for(i=1;i<=1000;i++) {
                    if(wanshu(i)==1)
                            System.out.println(i+"是完数");
                    else
                            continue;
            }
    }
    public static int wanshu(int i) {
            int sum = 0;
            for(int j=1;j<i;j++) {
                    if(i%j==0)
                            sum=sum+j;
            }
            if(sum==i)
                    return 1;
            else
                    return 0;
    }
}
